Skip to main content

sc.component

Functions for finding out which component types the computer can detect. Great for Plug & Play implementations.


Constants​

types​

sc.component.types = {}

A lookup table that maps the singular, lowercase name of every component type to the component type itself. This lets you pass component types into sc.getComponents without typing the exact name.

It is built from getComponentTypes, so it includes component types added by addons.

Variable NameActual Component Type
"gps""GPSs"
"camera""Cameras"
"motor""Motors"
"laser""Lasers"
"seatcontroller""SeatControllers"
"harddrive""Harddrives"
"gravitycontroller""GravityControllers"
"radarwarningreceiver""RadarWarningReceivers"
"hologram""Holograms"
"collisiondetector""CollisionDetectors"
"terminal""Terminals"
"light""Lights"
"powercomponent""PowerComponents"
"radar""Radars"
"display""Displays"
"networkport""NetworkPorts"

Example:

local displays = sc.getComponents(sc.component.types.display)

Functions​

getComponentTypes​

sc.component.getComponentTypes()

Gets the names of all component types that computers can detect. This includes component types added by addons.

Internal component types that are hidden from computers (like registers and antennas) are not included.

Returns:

  • [ string[] ] A list of all component type names, e.g. "Displays". The order is not guaranteed and may change between versions. (See sc.component.types and the "Actual Component Type" column in the table above for the exact names of component types.)